/**
 * 
 */
package com.xb.cloud.product.merchant.inner.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.xb.cloud.common.constant.DbConstants;
import com.xb.cloud.product.merchant.inner.service.ProductDescriptionInnerService;
import com.xb.cloud.product.merchant.service.impl.AbstractService;
import com.xb.cloud.product.service.business.model.ProductDescription;
import com.xb.cloud.product.service.business.model.ProductDescriptionExample;
import com.xb.cloud.product.service.business.model.mapper.ProductDescriptionMapper;

/**
 * 商品描述服务类
 * 
 * @author kexue
 *
 */
@Service
public class ProductDescriptionInnerServiceImpl extends AbstractService implements ProductDescriptionInnerService {

	private static final Logger LOGGER = LoggerFactory.getLogger(ProductDescriptionInnerServiceImpl.class);

	@Resource
	private ProductDescriptionMapper productDescriptionMapper;

	/**
	 * 取得 富文本描述
	 * 
	 * @param productId
	 * @return
	 */
	public String getDescriptionById(Long productId) {
		ProductDescriptionExample productDescriptionExample = new ProductDescriptionExample();
		com.xb.cloud.product.service.business.model.ProductDescriptionExample.Criteria createCriteria = productDescriptionExample
				.createCriteria();
		createCriteria.andProductIdEqualTo(productId);
		createCriteria.andIsDeletedEqualTo(DbConstants.IS_DELETED_FALSE);
		createCriteria.andIsEnabledEqualTo(DbConstants.TRUE);
		List<ProductDescription> productDescriptionList = productDescriptionMapper
				.selectByExampleWithBLOBs(productDescriptionExample);
		if (productDescriptionList != null && productDescriptionList.size() > 0) {
			return productDescriptionList.get(0).getDetailContent();
		}
		return null;
	}

}
